package com.example.mutichatkotlin

import android.app.Activity

class ActivityCollector {
    object Properties{
        var activities=ArrayList<Activity>()
    }
    companion object {
        fun addActivity(activity:Activity){
            Properties.activities.add(activity)
        }

        fun removeActivity(activity: Activity){
            Properties.activities.remove(activity)
        }

        fun finishAll(){
            Properties.activities.forEach{
                if(!it.isFinishing){
                    it.finish()
                }
            }
            Properties.activities.clear()
        }
    }
}